/*
 * @Date: 2023-01-12 19:40:56
 * @LastEditors: Zireael 1193875164@qq.com
 * @LastEditTime: 2023-03-22 15:29:23
 * @FilePath: \A19\backend\src\utils\sendEmail.ts
 */
import nodemailer from 'nodemailer';

//UEQVGVDXSHFEYAYO
const transporter = nodemailer.createTransport({
    service: '163',
    secure: true,
    auth: {
        user: 'herobrineprime@163.com',
        pass: 'UEQVGVDXSHFEYAYO'
    }
})

export async function sendEmail(to: string, code: string) {
    try {
        console.log(code);
        const ret = await transporter.sendMail({
            from: 'herobrineprime@163.com',
            to,
            subject: '验证码',
            html: `您的验证码是：<span style="font-weight:bold;">${code}</span>，如非本人操作，请忽略`,
        })
        
        return 
    } catch (error) {
        if(error instanceof Error)
        console.log(error.message);
    }
}